package com.jk.controller;

import com.jk.service.AuthUserIdcardService;
import com.jk.service.EmployeeService;
import com.jk.vo.AuthUserIdcard;
import com.jk.vo.Employee;
import com.jk.vo.WorkOrder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpSession;
import java.util.List;
import java.util.Map;

/**
 * 李向鹏 个人身份证查询
 */
@RestController
@RequestMapping("AuthUserIdcard")
public class AuthUserIdcardController {
    @Autowired
    private AuthUserIdcardService authUserIdcardService;
    /*查询个人身份证*/
    @GetMapping("SelectAuthUserIdcard")
    public List<Map> SelectAuthUserIdcard(AuthUserIdcard authUserIdcard){
        List<Map> authUserIdcardList = authUserIdcardService.SelectAuthUserIdcard(authUserIdcard);

        return authUserIdcardList;
    }

    @PutMapping("UpdateAuthUserIdcard")
    //userid是前台传过来用户id
    public  int UpdateAuthUserIdcard(AuthUserIdcard authUserIdcard,HttpSession request,String userid){
        Employee employeelog = (Employee) request.getAttribute("employeelog");
        WorkOrder workOrder = new WorkOrder();
        if (employeelog!=null){
            workOrder.setWmployeeId(employeelog.getEmployeeId());
        }else{
            workOrder.setWmployeeId("1");
        }
        workOrder.setUserId(userid);
       return authUserIdcardService.UpdateAuthUserIdcard(authUserIdcard,workOrder);
    }

}
